// pages/cart/index.js
import {
  getOaShopDetailPage
} from "../../../api/buy.js";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cartList: [{
      "id": 21465,
      "check": true,
      "name": "全棉针织条纹四件套 新款",
      "add_price": 299,
      "number": 1,
      "des": "1套",
      "url": "/images/图片/2.jpg",
    }, ]
  },
  onLoad() {
    this.getOaShopDetailPage()
  },
  getOaShopDetailPage(){
let data={
	"pageNum": "1",
	"pageSize": "10",
	"id": 1,
	"oaShopDetailType": 1,
	"oaShopDetailTypeId": null,
	"startTime": null,
	"overTime": null,
	"shopType": null,
	"shopTypeId": null,
	"purchasesNum": null,
	"payState": null,
	"orderState": null,
	"status": null,
	"delFlag": null,
	"createBy": null,
	"createTime": null,
	"updateBy": null,
	"updateTime": null,
	"remark": null
}
getOaShopDetailPage(data).then(res => {
  let datalist = res.data.data.records;
  console.log(datalist)
  this.setData({
    cartList: datalist,
    // lostprice:datalist[0].caVenueRental.lostPrice,
    // lostprice1:datalist[0].caVenueRental.lostPrice,
    // totalprice:datalist[0].caVenueRental.lostPrice,
    // num:datalist.length,
  })
})
  },
  // ListTouch触摸开始
  ListTouchStart(e) {
    this.setData({
      ListTouchStart: e.touches[0].pageX
    })
  },

  // ListTouch计算方向
  ListTouchMove(e) {
    this.setData({
      ListTouchDirection: e.touches[0].pageX - this.data.ListTouchStart > 0 ? 'right' : 'left'
    })
  },

  // ListTouch计算滚动
  ListTouchEnd(e) {
    if (this.data.ListTouchDirection == 'left') {
      this.setData({
        modalName: e.currentTarget.dataset.target
      })
    } else {
      this.setData({
        modalName: null
      })
    }
    this.setData({
      ListTouchDirection: null
    })
  },
  jumpPage(e) {
    wx.navigateTo({
      url: e.currentTarget.dataset.url,
    })
  }
})